package com.tql.mall.merchant.controller.api;

import com.tql.mall.merchant.service.ShopInfoService;
import com.tql.mall.merchant.service.StockInfoService;
import com.tql.mall.model.merchant.ShopInfo;
import com.tql.mall.model.merchant.StockInfoQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "第三方服务调用接口")
@RestController
@RequestMapping("/merchant/api/inner")
public class MerchantApiController {

    @Autowired
    private StockInfoService stockInfoService;
    @Autowired
    private ShopInfoService shopInfoService;


    /**
     * 校验库存，skuId，shopId，num不为空
     * @param stockInfoQueryVo
     * @return
     */
    @ApiOperation(value = "校验库存")
    @GetMapping("/checkStock")
    public Boolean checkStock(StockInfoQueryVo stockInfoQueryVo){
        return stockInfoService.checkoutStock(stockInfoQueryVo);
    }


    @ApiOperation(value = "根据id获取店铺信息")
    @GetMapping("/getShopInfoEntity/{id}")
    public ShopInfo getShopInfoEntity(@PathVariable Long id){
        return shopInfoService.getById(id);
    }



}
